package com.ruoyi.system.config;

import com.doudian.open.core.AccessToken;
import com.doudian.open.core.AccessTokenBuilder;
import com.doudian.open.core.GlobalConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class DouDianToken {
    public static AccessToken accessToken = new AccessToken();

    public static AccessToken getToken(String shopId) {
        switch (shopId) {
            case "175974257":
                GlobalConfig.initAppKey("7444805882086622760");
                GlobalConfig.initAppSecret("a2ed7006-78e7-4614-b27f-c3e1080a0864");
                accessToken = AccessTokenBuilder.build(175974257L);
                break;
            case "104110047":
                GlobalConfig.initAppKey("7329816210957157897");
                GlobalConfig.initAppSecret("52608104-4ff0-49e2-9eac-54979eda8353");
                accessToken = AccessTokenBuilder.build(104110047L);
                break;
            case "142993946":
                GlobalConfig.initAppKey("7337804791034168868");
                GlobalConfig.initAppSecret("93695392-b290-4250-9bd9-62a390a4367a");
                accessToken = AccessTokenBuilder.build(142993946L);
                break;
            default:
                log.info("传入的店铺id是非法的:{}", shopId);
        }
        return accessToken;
    }
}
